﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace GameStateManagement
{
    class SpeedBoost: PowerUp
    {
        public SpeedBoost(Game game, float magnitudeRatio, float speed)
            :base(game, magnitudeRatio, speed)
        {
            sMeshName = "SpeedPowerUp";
            type = "SpeedBoost";
            currentlyDisplayed = false;
            bPhysicsDriven = false;
        }

        public override void Initialize()
        {
            base.Initialize();
        }

        public override void Draw(GameTime gameTime)
        {
            if (currentlyDisplayed)
            {
                base.Draw(gameTime);
            }
        }
        public override void Update(GameTime gameTime)
        {
            abilityCounter.Update(gameTime);
            base.Update(gameTime);
        }
        override public void UseAbility(Player passedPlayer)
        {
            if (!passedPlayer.m_Ship.isBoosted)
            {
                passedPlayer.m_Ship.m_vVelocity *= 2;
                passedPlayer.m_Ship.fTerminalVelocity *= 2;
                passedPlayer.m_Ship.isBoosted = true;
                passedPlayer.m_Ship.activateSpeed();
                abilityCounter.AddTimer("speeddeactivate", 5f, new Utils.TimerDelegate(passedPlayer.m_Ship.deactivateSpeed), false);
            }
        }
    }
}
